package com.buba.controller;


import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.buba.service.PeopleManagementService;
import common.R;
import entity.sparemanage.vo.PeopleVo;
import entity.system.PeopleManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.buba.service.PeopleManagementService;
import common.R;
import entity.system.PeopleManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

import java.util.List;

/**
 * <p>
 * 人员管理 前端控制器
 * </p>
 *
 * @author beisheng
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/people-management")
public class PeopleManagementController {
    @Autowired
    private PeopleManagementService peopleManagementService;

    /**
     * @return common.R
     * @Author atlong
     * @Description 查询人员信息
     * @Date 2023/6/14 11:00
     * @Param []
     **/
    @GetMapping("selPrincipals")
    public R selPrincipals() {
        List<PeopleManagement> list = peopleManagementService.selPrincipals();
        return R.success(list);
    }
    /* *
     * @Author: beisheng
     * @Descriprion: 查询全部人员信息
     * @Date: 2023/5/19 15:37
     * @Return: common.R
     * @Param: []
     */

    @GetMapping("/selAllPeople")
    public R selAllPeople(){
        List<PeopleManagement> peopleManagements = peopleManagementService.list(new QueryWrapper<PeopleManagement>().eq("delete_flag", 0));
        return R.success(peopleManagements);
    }

    /* *
     * @Author: beisheng
     * @Descriprion: 根据人员ID查询人员信息和部门
     * @Date: 2023/5/25 9:55
     * @Return: entity.sparemanage.vo.PeopleVo
     * @Param: [id]
     */

    @GetMapping("/selOnePeople")
    public PeopleVo selOnePeople(@RequestBody Integer id){
        PeopleVo peopleVo = peopleManagementService.selOnePeople(id);
        return peopleVo;
    }

    /* *
     * @Author: beisheng
     * @Descriprion: 根据人员ID查询人员信息和部门
     * @Date: 2023/5/25 9:55
     * @Return: entity.sparemanage.vo.PeopleVo
     * @Param: [id]
     */

    @GetMapping("/selOnePeoples/{id}")
    public R selOnePeoples(@PathVariable("id") Integer id){
        PeopleVo peopleVo = peopleManagementService.selOnePeople(id);
        return R.success(peopleVo);
    }
}

